﻿public class mysolution {
    public static bool IsPrime(int n)
    {
        if (n == 2) { return true; }
        for(int i = 2; i < n / 2; i++)
        {
            if (n % i == 0) { return false; }
        }
        return true;
    }
    public int NextPrime(ref int p)
    {
        while (true)
        {
            p++;
            if (IsPrime(p)) { return p; }
        }
    }
    public static void Main(String[] args)
    {
        mysolution solution = new mysolution();
        Console.WriteLine("请输入数据");
        int n = int.Parse(Console.ReadLine());
        int n1 = n;
        int prime = 2;
        while (n1 != 1)
        {
            if (n1 % prime == 0)
            {
                Console.WriteLine(prime);
                n1 = n1 / prime;
            }
            else
            {
                solution.NextPrime(ref prime);
            }
        }
    }
}
